package ${package.Controller};

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.future.hair.server.config.result.CommonResult;
import com.future.hair.server.entity.${entity};
import com.future.hair.server.mapper.${table.mapperName};
import com.future.hair.server.model.PageModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;



/**
*
* @author ${author}
* @since ${date}
* @version v1.0
*/

@RestController
@RequestMapping("<#if package.ModuleName??>/${package.ModuleName}</#if>/hair/<#if controllerMappingHyphenStyle??>${controllerMappingHyphen}<#else>${table.entityPath}</#if>")

public class ${table.controllerName}{
    @Autowired
    private ${table.mapperName} mapper;

    public List<${entity}> ${table.entityPath}List(PageModel data) {
        return mapper.selectPage(new Page<>(data.getSize() , data.getCurrent()), null).getRecords();
    }

    public ${entity} ${table.entityPath}Id(${entity} data) {
        return mapper.selectById(data.getId());
    }

    public Integer create(${entity} data) {
        return mapper.insert(data);
    }

    public Integer update(${entity} data) {
        return mapper.updateById(data);
    }

    public Integer delete(${entity} data) {
        return mapper.deleteById(data.getId());
    }
}